package com.skit.mine.data

import com.skit.common.bean.User
import com.skit.common.config.RetrofitClient
import com.skit.common.http.NetResult
import com.skit.common.ktx.RetrofitKtx.getService
import com.skit.common.ktx.init
import com.skit.common.retrofit.UserProtocol
import retrofit2.Retrofit
import javax.inject.Inject

/**
 * @author shuike <a href="mailto:shuike007@126.com">Contact me.</a>
 * @version 1.0
 * @since 2021/06/01
 */
class PersonRepository @Inject constructor() {
    val retrofit: Retrofit = RetrofitClient.retroClient
    private val userServer: UserProtocol by lazy { retrofit.getService(UserProtocol::class.java) }

    suspend fun getUserInfo(id: Int, token: String): NetResult<User> {
        val userInfoSync = userServer.getUserInfoSync(id, token)
        return userInfoSync.init()
    }

}